package com.example.social.me.project;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomAdapter_jF extends ArrayAdapter<User_Info> {

	private Context mContext;
	private int mResources;
	private ArrayList<User_Info> mList;
	private LayoutInflater mInflater;
	
	
	public CustomAdapter_jF(Context context, int textViewResourceId,
			ArrayList<User_Info> objects) {
		super(context, textViewResourceId, objects);
		this.mContext = context;
		this.mResources = textViewResourceId;
		this.mList = objects;
		this.mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		User_Info listUser = mList.get(position);
		
		if(convertView == null)
		{
			convertView = mInflater.inflate(mResources, null);
		}
		
		if(listUser != null)
		{
			ImageView icon_profile = (ImageView)convertView.findViewById(R.id.icon_profile);
			ImageView icon_sex = (ImageView)convertView.findViewById(R.id.icon_sex);
			ImageView icon_follow = (ImageView)convertView.findViewById(R.id.icon_follow);
			
			TextView text_Name = (TextView)convertView.findViewById(R.id.text_Name);
			TextView text_birth = (TextView)convertView.findViewById(R.id.text_birth);
			TextView text_distance = (TextView)convertView.findViewById(R.id.text_distance);
			TextView text_follow =(TextView)convertView.findViewById(R.id.text_follow);
			
			text_Name.setText(listUser.get_Name());
			text_birth.setText(listUser.get_Date());
			text_distance.setText(Float.toString(listUser.get_Distance()));
			text_follow.setText(Integer.toString(listUser.get_Follow()));
			
		}
		return convertView;
	}

}
